<title>Xác Nhận Giỏ Hàng | Origami Shop Online | Origamishop.net</title>
<?php
	for($i=1;$i<=$_SESSION["count"];$i++)
	{
		if(isset($_SESSION["sp_id"][$i])&&isset($_SESSION["soluong"][$i]))
		{
	$ma = $_SESSION["sp_id"][$i];
	$sql = "select * from sp where sp_id = '".$ma."'";
	$result = DataProvider::ExecuteQuery($sql);
	$row = mysql_fetch_array($result);
	$tongtien += ($row["sp_gia"] * $_SESSION["soluong"][$i]) + ($row["sp_sall"]* $_SESSION["soluong"][$i]);
	$tongsluong += $_SESSION["soluong"][$i];
	$tbgia = $tongtien/$tongsluong;
	$sql ='select * from sp where sp_id = "'.$_SESSION["sp_id"][$i].'" ';
	$resul1t = DataProvider::ExecuteQuery($sql);
	$dong = mysql_fetch_array($resul1t);
	$sql ='select * from user where username = "'.$_SESSION["User"].'" ';
	$resul2t = DataProvider::ExecuteQuery($sql);
	$row1 = mysql_fetch_array($resul2t);
	$khang = $row1["fullname"].' - Địa Chỉ: '.$row1["address"].' - Số ĐT: '.$row1["cellphone"];
	$soluong1 = $_SESSION["soluong"][$i];
		}
	}
echo "
<br>
<form method='post' action='".$host["l_link"]."home.php?typ=product&act=addbill'>
<div id='ex'>
<div class='name'>Tên sản phẩm:</div>
<div class='labeln'><label>
";
echo  '<input type="text" name="product_name" value="';
if($_SESSION["IsLogin"] == true)
{
for($i=1;$i<$_SESSION["count"];$i++)
{
if(isset($_SESSION["sp_id"][$i]))
{
$ma = $_SESSION["sp_id"][$i];
$spham = "";
$sql ='select * from sp where sp_id = "'.$ma.'" ';
$result = DataProvider::ExecuteQuery($sql);
$dong = mysql_fetch_array($result);
$ttsp = '-ID:'.$_SESSION["sp_id"][$i].'-Tên SP:'.$dong["sp_ten"].'-SLượng:'.$_SESSION["soluong"][$i];
echo $ttsp;
}
}
echo '" style="width:100%">
</label></div>';
echo "
<div class='name'>Giá Trung Bình:</div>
<div class='labeln'><label>".$tbgia." đ
<input type='hidden' name='product_price' value='".$tbgia."' style='width:100%' /></label></div>
<div class='name'>Số Lượng:</div>
<div class='labeln'><label>".$tongsluong."
<input type='hidden' name='product_quantity' value='".$tongsluong."' style='width:100%' /></label></div>
<div class='name'>Thành tiền:</div>
<div class='labeln'><label>".$tongtien." đ
<input type='hidden' name='total_amount' value='".$tongtien."' style='width:100%' /></label></div>
<div class='name'>Khách Hàng:</div>
<div class='labeln'><label>".$khang."
<input type='hidden' name='product_description' value='".$khang."' style='width:100%;' rows='5' /></label></div>
<div></div><div><input type='submit' name='submit' value='Xác Nhận'></div>
</div>
</form>
";
if ($tongtien=='0')
{echo "
<br><a href='".$host["l_link"]."index.php'>
<strong>Trở Về Trang Chủ</strong></a>";
}else{echo "
<br><a href='".$host["l_link"]."home.php?typ=product&act=seecart'>
<strong>Hủy Thanh Toán</strong> </a>";
}
}
else
{
header("Location:home.php?typ=user&act=login");
}
?>
<br>

